package TestModifier;

import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.util.Arrays;

/**
 * Created by wangyg6 on 2017/10/17.
 */
public class Test {
	public static void main(String[] args) {
	/*	boolean ifs = String.class.equals(String.class);
		System.out.println(ifs);
		boolean ifInterface = Service.class.isInterface();
		System.out.println(ifInterface);
		Method[] declaredMethods = Service.class.getDeclaredMethods();
		Method[] methods = Service.class.getMethods();
		for (Method declaredMethod : declaredMethods) {
			System.out.println(declaredMethod.getName());
		}
		System.out.println("==========");
		for (Method method : methods) {
			System.out.print(method.getName() + "(" + Arrays.toString(method.getParameters()) + ")");
			System.out.println();
			;
		}
		System.out.println("-----------");

		int i = 16 & (~13);
		System.out.println(i);
		int i1 = 16 - 13;
		System.out.println(i1);

		int i2 = 13 & ~15;
		System.out.println(i2);
		String s = Integer.toBinaryString(~16);
		String s1 = Integer.toBinaryString(~13);
		System.out.println(s);
		System.out.println(s1);*/

		String s = Integer.toBinaryString(1);//public
		System.out.println(s);
		String s1 = Integer.toBinaryString(2);//private
		System.out.println(s1);
		String s2 = Integer.toBinaryString(4);//protected
		System.out.println(s2);
		String s3 = Integer.toBinaryString(8);//static
		System.out.println(s3);
		String s4 = Integer.toBinaryString(16);//final
		System.out.println(s4);
		System.out.println("public static final的modifiers是"+(1|8|16));
		System.out.println("判断是否存在某个modifier直接&即可：ifPublic:"+(Modifier.isPublic(9)));
		System.out.println("public static final 去掉final:"+(25-16));
		System.out.println("public static final 去掉final:"+(25&~16));
		int i = 25 & 1;
		int i1 = 25 & ~1;
		System.out.printf("%d %d" ,i,i1);


	}
}
